package renderernode;
import java.util.ArrayList;

import parser.*;

public abstract class TreeNode {

	private ArrayList<TreeNode> children;
	private TreeNode parent;
	private boolean leaf;//i dont know why you comment this line attribute but i thing is need for the parser node since there is a condition
	                    //that we have to check if the node is a leaf node, more preciasly a node that cannot have children->text or image node
	                   //if you have a better way of checking that comment this and right in comment the alternative

	public TreeNode() {
		parent = null;
	}

	public abstract void drawNode(Display theDisplay);

	public void addChild(TreeNode theChild)
	{
		children.add(theChild);
		theChild.parent = this;
	}

	public TreeNode getChild(int i)
	{
		return children.get(i);
	}

//	public void accept(Visitor visitor) {
//		visitor.visit(this);
//	}
	
	public Boolean isLeaf()
	{
		return leaf;
	}
}